package com.lhc.event;

import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

/**
 * @author LuHuanCheng
 * 类说明：为spring更新事件定义一个事件类
 */
@Component
public class SpringRefreshedListener implements ApplicationListener<ContextRefreshedEvent> {

    public void onApplicationEvent(ContextRefreshedEvent event) {
        //监听到这个事件是因为启动流程发布了这个事件  finishRefresh方法里面的publishEvent(new ContextRefreshedEvent(this));
        System.out.println("== 监听到容器加载完成事件ContextRefreshedEvent，do something");
    }
}